#include <stdio.h>
#include <stddef.h>

extern int getword(char *lbuf, char *buf, size_t size, int first(char c), int rest(char c));
/**extern int getword(char *lbuf, char *buf, size_t size, int first(char c), int rest(char c));
 * Reads the next `word` from the string lbuf and stores it as a null-terminated
 * string in buf[0..size-1] and returns the number of characters read from the
 * buffer NOTE THAT THIS DIFFERS FROM getword, in that it returns the number of
 * characters actually read, not the number of chacters return.
 *
 * When getword2 reaches the end of the string lbuf without consuming a word, it
 * return EOL. If a word is longer than size-1 characters, the excess characters
 * are ignored. Excess characters are still counted in the return value, however.
 *
 * first and rest identify the characters that comprise a word: A word is a con-
 * tiguous sequence of characters that begins with a character for which first
 * returns nonzero followed by zero or more character for which rest returns nonzero.
 *
 * It is a checked runtime error for lbuf, buf, first, or rest to be NULL or for
 * size to be 0.
 */